<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>XenC: include/kenlm/util/double-conversion/bignum.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">XenC
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">Open-source tool for data selection in NLP</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_5417fc49d29c4cfca6bc3f52c9c7deba.html">kenlm</a></li><li class="navelem"><a class="el" href="dir_9ec25de6763e2dc47109730f881b7e3e.html">util</a></li><li class="navelem"><a class="el" href="dir_5fd0dc67f55ed56e6f450361f3921d3b.html">double-conversion</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">bignum.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="bignum_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Copyright 2010 the V8 project authors. All rights reserved.</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">// Redistribution and use in source and binary forms, with or without</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// modification, are permitted provided that the following conditions are</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">// met:</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">//     * Redistributions of source code must retain the above copyright</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">//       notice, this list of conditions and the following disclaimer.</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">//     * Redistributions in binary form must reproduce the above</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">//       copyright notice, this list of conditions and the following</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">//       disclaimer in the documentation and/or other materials provided</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">//       with the distribution.</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">//     * Neither the name of Google Inc. nor the names of its</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">//       contributors may be used to endorse or promote products derived</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">//       from this software without specific prior written permission.</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#ifndef DOUBLE_CONVERSION_BIGNUM_H_</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#define DOUBLE_CONVERSION_BIGNUM_H_</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="utils_8h.html">utils.h</a>&quot;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacedouble__conversion.html">double_conversion</a> {</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html">   35</a></span>&#160;<span class="keyword">class </span><a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  <span class="comment">// 3584 = 128 * 28. We can represent 2^3584 &gt; 10^1000 accurately.</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  <span class="comment">// This bignum can encode much bigger numbers, since it contains an</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  <span class="comment">// exponent.</span></div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a0809fab3b9340d53a626399b27eb4a69">   40</a></span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a0809fab3b9340d53a626399b27eb4a69">kMaxSignificantBits</a> = 3584;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;  <a class="code" href="classdouble__conversion_1_1_bignum.html#a8e78706b840d7a6b25500d432b5b2f33">Bignum</a>();</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ad6925190c4d9c2a3ae7bf921dae28b24">AssignUInt16</a>(uint16_t value);</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a5c8354f55ec6ce509e27f8f25c7cb3fc">AssignUInt64</a>(uint64_t value);</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a1dda91e7515a81b28def9a9cfaf3eb38">AssignBignum</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other);</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ab554bdcd6379e12798a002a4bafaf3a6">AssignDecimalString</a>(<a class="code" href="classdouble__conversion_1_1_vector.html">Vector&lt;const char&gt;</a> value);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a56aeb4e384816b309c69c424ac02d5a9">AssignHexString</a>(<a class="code" href="classdouble__conversion_1_1_vector.html">Vector&lt;const char&gt;</a> value);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a2e1df2641bb27f7c4cd2ec623ad69c2b">AssignPowerUInt16</a>(uint16_t base, <span class="keywordtype">int</span> exponent);</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ac8e78d0095060769791221fdad6bff26">AddUInt16</a>(uint16_t operand);</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#aa0fc98a9384e3434aec623f8c123d9a0">AddUInt64</a>(uint64_t operand);</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ac4359a8087a0f85dea29e69e4726b7a6">AddBignum</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other);</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  <span class="comment">// Precondition: this &gt;= other.</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ab36b462744555f89ab683ad8a99cbd26">SubtractBignum</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other);</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ab1978cff5f41486065e8c19cf5020118">Square</a>();</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a8f0ed0e693ae91be26d9b00f022a166a">ShiftLeft</a>(<span class="keywordtype">int</span> shift_amount);</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a7b6cb041141fe56750183b63d340885e">MultiplyByUInt32</a>(uint32_t factor);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a09605cc42b05ce21a5f93e7067f7a23c">MultiplyByUInt64</a>(uint64_t factor);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a232755e712a00facb1dc8e2ffe5f2b8d">MultiplyByPowerOfTen</a>(<span class="keywordtype">int</span> exponent);</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#ac05c9d0b061d44e3aec30de798b8c52a">   63</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#ac05c9d0b061d44e3aec30de798b8c52a">Times10</a>() { <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a7b6cb041141fe56750183b63d340885e">MultiplyByUInt32</a>(10); }</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <span class="comment">// Pseudocode:</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="comment">//  int result = this / other;</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  <span class="comment">//  this = this % other;</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;  <span class="comment">// In the worst case this function is in O(this/other).</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  uint16_t <a class="code" href="classdouble__conversion_1_1_bignum.html#a605cd8ba050ab0643d33a814363e61c5">DivideModuloIntBignum</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other);</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a911272207695ea793e5e32d69ce03129">ToHexString</a>(<span class="keywordtype">char</span>* buffer, <span class="keywordtype">int</span> buffer_size) <span class="keyword">const</span>;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <span class="comment">// Returns</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  <span class="comment">//  -1 if a &lt; b,</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  <span class="comment">//   0 if a == b, and</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  <span class="comment">//  +1 if a &gt; b.</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#aa1686eccaa3f0ba8f62333b188c5af00">Compare</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b);</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a380d44720656dbd8c0101bdd4fb6b566">   77</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a380d44720656dbd8c0101bdd4fb6b566">Equal</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b) {</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#aa1686eccaa3f0ba8f62333b188c5af00">Compare</a>(a, b) == 0;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;  }</div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a6ebb2a3c009692ccea79bc0661761c61">   80</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a6ebb2a3c009692ccea79bc0661761c61">LessEqual</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b) {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#aa1686eccaa3f0ba8f62333b188c5af00">Compare</a>(a, b) &lt;= 0;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  }</div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a7116d79e9d236a6912dfe0ff46917503">   83</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a7116d79e9d236a6912dfe0ff46917503">Less</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b) {</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#aa1686eccaa3f0ba8f62333b188c5af00">Compare</a>(a, b) &lt; 0;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  }</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  <span class="comment">// Returns Compare(a + b, c);</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a88ab973c57509adec57e76d8b3129b87">PlusCompare</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; c);</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;  <span class="comment">// Returns a + b == c</span></div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a815b255f9f5466970a2c86bc5d7bd4e0">   89</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a815b255f9f5466970a2c86bc5d7bd4e0">PlusEqual</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; c) {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a88ab973c57509adec57e76d8b3129b87">PlusCompare</a>(a, b, c) == 0;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  <span class="comment">// Returns a + b &lt;= c</span></div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#a3adacffb85f83f4262aefb6faa7e58c7">   93</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a3adacffb85f83f4262aefb6faa7e58c7">PlusLessEqual</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; c) {</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a88ab973c57509adec57e76d8b3129b87">PlusCompare</a>(a, b, c) &lt;= 0;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  }</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <span class="comment">// Returns a + b &lt; c</span></div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classdouble__conversion_1_1_bignum.html#abab6848f165f8ba61e965603735e1853">   97</a></span>&#160;  <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#abab6848f165f8ba61e965603735e1853">PlusLess</a>(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; a, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; b, <span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; c) {</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classdouble__conversion_1_1_bignum.html#a88ab973c57509adec57e76d8b3129b87">PlusCompare</a>(a, b, c) &lt; 0;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  }</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160; <span class="keyword">private</span>:</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  <span class="keyword">typedef</span> uint32_t Chunk;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  <span class="keyword">typedef</span> uint64_t DoubleChunk;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kChunkSize = <span class="keyword">sizeof</span>(Chunk) * 8;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kDoubleChunkSize = <span class="keyword">sizeof</span>(DoubleChunk) * 8;</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  <span class="comment">// With bigit size of 28 we loose some bits, but a double still fits easily</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;  <span class="comment">// into two chunks, and more importantly we can use the Comba multiplication.</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kBigitSize = 28;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> Chunk kBigitMask = (1 &lt;&lt; kBigitSize) - 1;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;  <span class="comment">// Every instance allocates kBigitLength chunks on the stack. Bignums cannot</span></div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  <span class="comment">// grow. There are no checks if the stack-allocated space is sufficient.</span></div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> kBigitCapacity = kMaxSignificantBits / kBigitSize;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <span class="keywordtype">void</span> EnsureCapacity(<span class="keywordtype">int</span> size) {</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keywordflow">if</span> (size &gt; kBigitCapacity) {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;      <a class="code" href="utils_8h.html#ad8fee49eb2770153a2dd95953f9b74e5">UNREACHABLE</a>();</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    }</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  }</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <span class="keywordtype">void</span> Align(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;  <span class="keywordtype">void</span> Clamp();</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;  <span class="keywordtype">bool</span> IsClamped() <span class="keyword">const</span>;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  <span class="keywordtype">void</span> Zero();</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  <span class="comment">// Requires this to have enough capacity (no tests done).</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;  <span class="comment">// Updates used_digits_ if necessary.</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;  <span class="comment">// shift_amount must be &lt; kBigitSize.</span></div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;  <span class="keywordtype">void</span> BigitsShiftLeft(<span class="keywordtype">int</span> shift_amount);</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;  <span class="comment">// BigitLength includes the &quot;hidden&quot; digits encoded in the exponent.</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  <span class="keywordtype">int</span> BigitLength()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> used_digits_ + exponent_; }</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  Chunk BigitAt(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  <span class="keywordtype">void</span> SubtractTimes(<span class="keyword">const</span> <a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>&amp; other, <span class="keywordtype">int</span> factor);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  Chunk bigits_buffer_[kBigitCapacity];</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  <span class="comment">// A vector backed by bigits_buffer_. This way accesses to the array are</span></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  <span class="comment">// checked for out-of-bounds errors.</span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;  <a class="code" href="classdouble__conversion_1_1_vector.html">Vector&lt;Chunk&gt;</a> bigits_;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  <span class="keywordtype">int</span> used_digits_;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;  <span class="comment">// The Bignum&#39;s value equals value(bigits_) * 2^(exponent_ * kBigitSize).</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <span class="keywordtype">int</span> exponent_;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;  DISALLOW_COPY_AND_ASSIGN(<a class="code" href="classdouble__conversion_1_1_bignum.html">Bignum</a>);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;};</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;}  <span class="comment">// namespace double_conversion</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="preprocessor">#endif  // DOUBLE_CONVERSION_BIGNUM_H_</span></div><div class="ttc" id="classdouble__conversion_1_1_bignum_html_a8f0ed0e693ae91be26d9b00f022a166a"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a8f0ed0e693ae91be26d9b00f022a166a">double_conversion::Bignum::ShiftLeft</a></div><div class="ttdeci">void ShiftLeft(int shift_amount)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a8e78706b840d7a6b25500d432b5b2f33"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a8e78706b840d7a6b25500d432b5b2f33">double_conversion::Bignum::Bignum</a></div><div class="ttdeci">Bignum()</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a7116d79e9d236a6912dfe0ff46917503"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a7116d79e9d236a6912dfe0ff46917503">double_conversion::Bignum::Less</a></div><div class="ttdeci">static bool Less(const Bignum &amp;a, const Bignum &amp;b)</div><div class="ttdef"><b>Definition:</b> bignum.h:83</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_abab6848f165f8ba61e965603735e1853"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#abab6848f165f8ba61e965603735e1853">double_conversion::Bignum::PlusLess</a></div><div class="ttdeci">static bool PlusLess(const Bignum &amp;a, const Bignum &amp;b, const Bignum &amp;c)</div><div class="ttdef"><b>Definition:</b> bignum.h:97</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a911272207695ea793e5e32d69ce03129"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a911272207695ea793e5e32d69ce03129">double_conversion::Bignum::ToHexString</a></div><div class="ttdeci">bool ToHexString(char *buffer, int buffer_size) const </div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a56aeb4e384816b309c69c424ac02d5a9"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a56aeb4e384816b309c69c424ac02d5a9">double_conversion::Bignum::AssignHexString</a></div><div class="ttdeci">void AssignHexString(Vector&lt; const char &gt; value)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a09605cc42b05ce21a5f93e7067f7a23c"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a09605cc42b05ce21a5f93e7067f7a23c">double_conversion::Bignum::MultiplyByUInt64</a></div><div class="ttdeci">void MultiplyByUInt64(uint64_t factor)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ab36b462744555f89ab683ad8a99cbd26"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ab36b462744555f89ab683ad8a99cbd26">double_conversion::Bignum::SubtractBignum</a></div><div class="ttdeci">void SubtractBignum(const Bignum &amp;other)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a1dda91e7515a81b28def9a9cfaf3eb38"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a1dda91e7515a81b28def9a9cfaf3eb38">double_conversion::Bignum::AssignBignum</a></div><div class="ttdeci">void AssignBignum(const Bignum &amp;other)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html">double_conversion::Bignum</a></div><div class="ttdef"><b>Definition:</b> bignum.h:35</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ac4359a8087a0f85dea29e69e4726b7a6"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ac4359a8087a0f85dea29e69e4726b7a6">double_conversion::Bignum::AddBignum</a></div><div class="ttdeci">void AddBignum(const Bignum &amp;other)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ac8e78d0095060769791221fdad6bff26"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ac8e78d0095060769791221fdad6bff26">double_conversion::Bignum::AddUInt16</a></div><div class="ttdeci">void AddUInt16(uint16_t operand)</div></div>
<div class="ttc" id="utils_8h_html"><div class="ttname"><a href="utils_8h.html">utils.h</a></div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_aa1686eccaa3f0ba8f62333b188c5af00"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#aa1686eccaa3f0ba8f62333b188c5af00">double_conversion::Bignum::Compare</a></div><div class="ttdeci">static int Compare(const Bignum &amp;a, const Bignum &amp;b)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_vector_html"><div class="ttname"><a href="classdouble__conversion_1_1_vector.html">double_conversion::Vector</a></div><div class="ttdef"><b>Definition:</b> utils.h:155</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a0809fab3b9340d53a626399b27eb4a69"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a0809fab3b9340d53a626399b27eb4a69">double_conversion::Bignum::kMaxSignificantBits</a></div><div class="ttdeci">static const int kMaxSignificantBits</div><div class="ttdef"><b>Definition:</b> bignum.h:40</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_aa0fc98a9384e3434aec623f8c123d9a0"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#aa0fc98a9384e3434aec623f8c123d9a0">double_conversion::Bignum::AddUInt64</a></div><div class="ttdeci">void AddUInt64(uint64_t operand)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ab554bdcd6379e12798a002a4bafaf3a6"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ab554bdcd6379e12798a002a4bafaf3a6">double_conversion::Bignum::AssignDecimalString</a></div><div class="ttdeci">void AssignDecimalString(Vector&lt; const char &gt; value)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a7b6cb041141fe56750183b63d340885e"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a7b6cb041141fe56750183b63d340885e">double_conversion::Bignum::MultiplyByUInt32</a></div><div class="ttdeci">void MultiplyByUInt32(uint32_t factor)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a815b255f9f5466970a2c86bc5d7bd4e0"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a815b255f9f5466970a2c86bc5d7bd4e0">double_conversion::Bignum::PlusEqual</a></div><div class="ttdeci">static bool PlusEqual(const Bignum &amp;a, const Bignum &amp;b, const Bignum &amp;c)</div><div class="ttdef"><b>Definition:</b> bignum.h:89</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a88ab973c57509adec57e76d8b3129b87"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a88ab973c57509adec57e76d8b3129b87">double_conversion::Bignum::PlusCompare</a></div><div class="ttdeci">static int PlusCompare(const Bignum &amp;a, const Bignum &amp;b, const Bignum &amp;c)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ab1978cff5f41486065e8c19cf5020118"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ab1978cff5f41486065e8c19cf5020118">double_conversion::Bignum::Square</a></div><div class="ttdeci">void Square()</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a2e1df2641bb27f7c4cd2ec623ad69c2b"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a2e1df2641bb27f7c4cd2ec623ad69c2b">double_conversion::Bignum::AssignPowerUInt16</a></div><div class="ttdeci">void AssignPowerUInt16(uint16_t base, int exponent)</div></div>
<div class="ttc" id="utils_8h_html_ad8fee49eb2770153a2dd95953f9b74e5"><div class="ttname"><a href="utils_8h.html#ad8fee49eb2770153a2dd95953f9b74e5">UNREACHABLE</a></div><div class="ttdeci">#define UNREACHABLE()  </div><div class="ttdef"><b>Definition:</b> utils.h:42</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a5c8354f55ec6ce509e27f8f25c7cb3fc"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a5c8354f55ec6ce509e27f8f25c7cb3fc">double_conversion::Bignum::AssignUInt64</a></div><div class="ttdeci">void AssignUInt64(uint64_t value)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a605cd8ba050ab0643d33a814363e61c5"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a605cd8ba050ab0643d33a814363e61c5">double_conversion::Bignum::DivideModuloIntBignum</a></div><div class="ttdeci">uint16_t DivideModuloIntBignum(const Bignum &amp;other)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ac05c9d0b061d44e3aec30de798b8c52a"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ac05c9d0b061d44e3aec30de798b8c52a">double_conversion::Bignum::Times10</a></div><div class="ttdeci">void Times10()</div><div class="ttdef"><b>Definition:</b> bignum.h:63</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a6ebb2a3c009692ccea79bc0661761c61"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a6ebb2a3c009692ccea79bc0661761c61">double_conversion::Bignum::LessEqual</a></div><div class="ttdeci">static bool LessEqual(const Bignum &amp;a, const Bignum &amp;b)</div><div class="ttdef"><b>Definition:</b> bignum.h:80</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_ad6925190c4d9c2a3ae7bf921dae28b24"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#ad6925190c4d9c2a3ae7bf921dae28b24">double_conversion::Bignum::AssignUInt16</a></div><div class="ttdeci">void AssignUInt16(uint16_t value)</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a380d44720656dbd8c0101bdd4fb6b566"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a380d44720656dbd8c0101bdd4fb6b566">double_conversion::Bignum::Equal</a></div><div class="ttdeci">static bool Equal(const Bignum &amp;a, const Bignum &amp;b)</div><div class="ttdef"><b>Definition:</b> bignum.h:77</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a3adacffb85f83f4262aefb6faa7e58c7"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a3adacffb85f83f4262aefb6faa7e58c7">double_conversion::Bignum::PlusLessEqual</a></div><div class="ttdeci">static bool PlusLessEqual(const Bignum &amp;a, const Bignum &amp;b, const Bignum &amp;c)</div><div class="ttdef"><b>Definition:</b> bignum.h:93</div></div>
<div class="ttc" id="namespacedouble__conversion_html"><div class="ttname"><a href="namespacedouble__conversion.html">double_conversion</a></div><div class="ttdef"><b>Definition:</b> bignum-dtoa.h:33</div></div>
<div class="ttc" id="classdouble__conversion_1_1_bignum_html_a232755e712a00facb1dc8e2ffe5f2b8d"><div class="ttname"><a href="classdouble__conversion_1_1_bignum.html#a232755e712a00facb1dc8e2ffe5f2b8d">double_conversion::Bignum::MultiplyByPowerOfTen</a></div><div class="ttdeci">void MultiplyByPowerOfTen(int exponent)</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 18 2016 17:22:37 for XenC by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
